package cn.comon.app.scan.service.analysis.impl;

import java.util.Properties;

import net.sf.json.JSONObject;

import org.apache.log4j.Logger;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import cn.comon.app.scan.entity.AsReportinfo;
import cn.comon.app.scan.service.analysis.IAnalysisResponse;

/**
 * 腾讯软件检测接口请求响应返回值处理
 * @author xujf
 *
 */
@Service("qqResponseImpl")
@Scope("prototype")
@Lazy(value=true)
public class TencentAnalysisResponseImpl implements IAnalysisResponse {
    private static Logger logger = Logger.getLogger(TencentAnalysisResponseImpl.class.getName());
    
	public void processResponse(Properties params, AsReportinfo asReportinfo, Object result) {
	    //发送成功后，不管这个请求返回的是正常还是异常。什么都不做。
	    //就等检测完后的结果回来之后，才根据检测结果更新checkcount和过期时间。
	    String resultFlg = "";
	    String reasonFlg = "";
        JSONObject jSONObject= JSONObject.fromObject(result);
        resultFlg = jSONObject.getString("result");
        reasonFlg = jSONObject.getString("reason");
        logger.info("send result form Tencent [Reportinfo ID:" + asReportinfo.getId() + "]:" + resultFlg);
        logger.info("send reason form Tencent [Reportinfo ID:" + asReportinfo.getId() + "]:" + reasonFlg);

	}
}